<%
  levels=Level::OPTIONS
  ranks = Rank::OPTIONS
  @user = conventioner.user
%>
<td id="add_user" colspan="7">
  <p/>
  <% remote_form_for :user,:url=>{:controller=>'events_users',:action=>'update',:id=>conventioner.id} do |f| %>
    <div id="errors" style="display:none">
    </div>
    <br/>
    <div class="fields text_fields">
      <%= f.label :name,'人员名称:' %><%= f.text_field :name %><br clear="all"/>
    </div>
   <div class="fields text_fields">
      <%= f.label :form,'单位:' %>
      <select name="user[form]" id="user_form">
        <%=
          option_groups_from_collection_for_select(Units::OPTIONS,
                                                          :options,:type_name,
                                                          :name,:name,
                                                          @user.form
          )
        %>
      </select>
      <br clear="all"/>
    </div>
    <div class="fields text_fields">
      <%= f.label :job_title,'职务:' %>
      <select name="user[job_title]" id="user_job_title">
        <%=
          option_groups_from_collection_for_select(Job_title::OPTIONS,
                                                          :options,:type_name,
                                                          :name,:name,
                                                          @user.job_title
          )
        %>
      </select>
      <br clear="all"/>
    </div>
    <div class="fields select_fields">
      <%= f.label :sex,'性别:' %><%=f.select :sex,%w{男 女}%><br clear="all"/>
    </div>
    <div class="fields text_fields">
      <%= f.label :tel,'联系电话:' %><%= f.text_field :tel %><br clear="all"/>
    </div>
    <div class="fields text_fields">
      <%= f.label :card_id,'证件号:' %><%= f.text_field :card_id %><br clear="all"/>
    </div>
    <div class="fields select_fields">
      <%= f.label :level,'级别:' %><%= f.select(:level,levels) %><br clear="all"/>
    </div>
    <div class="fields select_fields">
      <%= f.label :rank,'军衔:' %><%= f.select(:rank,ranks) %><br clear="all"/>
    </div>
    <%if conventioner%>
      <%fields_for :conventioner do |c_f|%>
        <div class="fields select_fields">
          <%= c_f.label :category,'工作类型:' %><%= c_f.select(:category,%w{会议代表 列席代表 工作人员}) %><br clear="all"/>
        </div>
        <div class="fields text_fields">
          <%= c_f.label :is_leader,'领导:' %><%= c_f.check_box(:is_leader)%><br clear="all"/>
        </div>
        <input id="conventioner_arrive" type="checkbox" onclick="Element.toggle('arrive')" name="conventioner[arrive]" value="false"/>
        <span>设置抵达车次/航班</span>
        <div id="arrive" class="fields text_fields" style="display:none">
          <%= c_f.label :arrive_id,'抵达车次/航班:' %><%= c_f.collection_select(:arrive_id,conventioner.event.arrife,:id,:ticket_number) %><br clear="all"/>
        </div>
        <input id="conventioner_revert" type="checkbox" onclick="Element.toggle('revert')" name="conventioner[revert]"/>
        <span>设置返程车次/航班</span>
        <div id="revert" class="fields select_fields" style="display:none">
          <%= c_f.label :revert_id,'返程车次/航班:' %><%= c_f.collection_select(:revert_id,conventioner.event.reverts,:id,:ticket_number) %><br clear="all"/>
        </div>
      <%end%>
    <%end%>
    <div class="buttons">
      <div class="lt_button">
        <%= f.submit '更新人员信息',:class=>'submit' %> | <%=link_to_remote '取消编辑',:update=>"edit_place_#{conventioner.id}",:url=>{:controller=>'events_users',:action=>'hide_edit',:id=>conventioner.id},:class=>'button'%>
      </div>
      
    </div>
  <% end %>
</td>